<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS</title>
</head>
<body>

    <button onclick="alert">点击我</button>
    <script>


        // let name=prompt("请输入你的姓名：");
        // let age=prompt("请输入你的年纪：");
        // let sex=prompt("请输入你的性别：");
        // alert("姓名："+name+"\n年纪："+age+"\n性别："+sex);


        // let num=5;
        // let num1='hello';
        // // alert(num+num1);

        let num=10;
        let num1='10';

        alert(num==num1);
        alert(num===num1);
    </script>  



<!-- <button  onclick="alert('hello')">点击我</button>
<p></p>
<button onclick="alert">点击我</button>
<script>
    alert('hello');
</script> -->


<!-- <button id="btn" value="点我一下" onclick="console.log('java script');"></button>
<script>
    alert(document.getElementById('btn').value);
</script> -->


<script>
    // let student={

    //     name:'帅哥',
    //     age:20,
    //     height:180,
    //     weight:70,
    //     sing:function(){
    //         console.log("你太美");
    //     },
    //     dance:function(){
    //         console.log('篮球');
    //     }

    // };

    var student = new Object(); // 和创建数组类似
        student.name = "蔡徐坤";
        student.age=20;
        student.height = 175;
        student.weight = 170;
        student.sing = function () {
        console.log("hello");
        }

    console.log(student.name);
    console.log(student.age);
    console.log(student.height);
    console.log(student.weight);
    //console.log(student.dance());
    student.sing();
</script>


    <script>

        function add() {
        let sum = 0;
        for (let elem of arguments)
        {
            sum+=elem;
        }

    return sum;
}
console.log(add(10, 20)); // 30
console.log(add(1, 2, 3, 4)); // 10
console.log(add(10,20,30)); 
console.log(typeof add); 



        function add1(x,y)
        {
            return x+y;
        }
        console.log(add1(10,20));
        console.log(add1('hello','world'));
        console.log(add1(10,true));
        console.log(add1(undefined,10));
        console.log(add1(undefined,'10'));
    </script>

    <script>

        var arr=[];
        var arr1=[1,2,3,4];
        var arr2=[1,'hello',true,1000];
        console.log(arr2[0]);
        console.log(arr2[1]);
        console.log(arr2[2]);
        console.log(arr2[3]);
        console.log(arr2);
        console.log(arr2[100]);
        arr2.push(11);
        for(let i in arr2)
        {
            //i是下标
            console.log(arr2[i]);
        }
        for(let elem of arr2)
        {
            //elem是元素
            console.log(elem);
        }

    </script>

<hr>
    <!-- <div onclick="alert('hello')">点我试一试</div>
    <script src="js.js"></script> -->


    <script>
        //alert('hello');
        //console.log('hello world');
        var a=10;
        console.log(a);
        let b="hello aaa";
        console.log(b);
        let c=10;
        let d='10';
        console.log(c===d);

    </script>
</body>
</html>